home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / white.arc / AUTORUN.4TH next >
Encoding:
Text File  |  1986-11-07  |  2.4 KB  |  65 lines

  1. \ F-INIT - intialize things like COLD but no QUIT     18Mar84RSW
  2.         FORTH DEFINITIONS HEX
  3.  ( This is for MVP-FORTH ver 1.0305.0X only )
  4.  
  5. VARIABLE OLD-COLD  \ storage for no parameter startup routine
  6.  
  7. : F-INIT  ( -- )                \ like MVP  COLD routine
  8.    EMPTY-BUFFERS
  9.    11D 14D @ 6 + 30 CMOVE
  10.    1 DENSITY !  FIRST USE !  FIRST PREV ! DR0
  11.    0 EPRINT !
  12.    11B @ ' FORTH 2+ !
  13.    [COMPILE] DECIMAL
  14.    SP! ?STACK
  15.    [COMPILE] FORTH DEFINITIONS  \ but does not vector to QUIT
  16.    ;   DECIMAL          -->
  17. \ ?AUTO-RUN new coldstart routine                     18Mar84RSW
  18.         FORTH DEFINITIONS HEX
  19. : ?AUTO-RUN     F-INIT            \ do initialization
  20.    80 DUP C@ ?DUP IF              \ parameters passed?
  21.      1- SWAP 2+ SWAP ( ad1 n -- ) \  YES - set up string
  22.      1 BUFFER ( ad1 n ad2 -- )
  23.      DUP 400 0 FILL               \   null out buffer to use
  24.      SWAP CMOVE 0 >IN ! 1 BLK !   \   move into BLOCK BUFFER 1
  25.      RP! INTERPRET                \   do as directed on cmd line
  26.      EMPTY-BUFFERS CR ." OK"
  27.      ABORT                        \   leave in good state
  28.    ELSE
  29.      DROP OLD-COLD @ EXECUTE      \  NO - do non-parameter stuff
  30.    THEN ; DECIMAL       -->
  31.  
  32.  
  33. \ install ?AUTO-RUN new coldstart routine             18Mar84RSW
  34.         FORTH DEFINITIONS HEX
  35.  
  36. 117 CONSTANT STARTVEC   ( MVP-FORTH 1.0305.0X startup vector )
  37.  
  38.  STARTVEC @ @ OLD-COLD ! ( save old startup routine )
  39.  
  40.  ' ?AUTO-RUN CFA STARTVEC @ ! ( set new startup routine )
  41.  
  42.  FREEZE DECIMAL EXIT
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. ( automatic command run description )   EXIT          18Mar84RSW
  50.         The preceeding screens install a new cold start routine
  51. in the MVP-Forth interpreter.  This new ?AUTO-RUN routine will
  52. process and run any legal interpretive Forth commands passed to
  53. it on the DOS command line (ie. after the program name).  Up to
  54. about 124 significant letters can be interpreted in this manner
  55. before the input source is returned to the console.  If no
  56. commands are given on the command line - nothing will be
  57. automatically done and the Forth interpreter will sign on in the
  58. normal fashion.  For example:
  59.     A>forthse4 FF RESETLP DOCCHAR BYE
  60.  
  61.     A>_
  62. will formfeed the line printer, set it to elite character mode
  63. and then return to DOS without the user having to type anything.
  64. This is intended to make FORTHSE4.COM usable in a .BAT file.
  65. nd then return to DOS without the user having to typ